<?php /*a:1:{s:67:"D:\phpstudy_pro\WWW\mrht5.3\application\admin\view\login\index.html";i:1648208647;}*/ ?>
<!DOCTYPE html>
<html lang="zh">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
    <title>后台管理登录</title>
    <link rel="stylesheet" type="text/css" href="/static/css/materialdesignicons.min.css">
    <link rel="stylesheet" type="text/css" href="/static/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="/static/css/animate.min.css">
    <link rel="stylesheet" type="text/css" href="/static/css/style.min.css">
    <link rel="stylesheet" type="text/css" href="/static/js/jquery-confirm/jquery-confirm.min.css">
    <style>
        .login-form .has-feedback {
            position: relative;
        }
        .login-form .has-feedback .form-control {
            padding-left: 36px;
        }
        .login-form .has-feedback .mdi {
            position: absolute;
            top: 0;
            left: 0;
            right: auto;
            width: 36px;
            height: 36px;
            line-height: 36px;
            z-index: 4;
            color: #dcdcdc;
            display: block;
            text-align: center;
            pointer-events: none;
        }
        .login-form .has-feedback.row .mdi {
            left: 15px;
        }
    </style>
</head>

<body class="center-vh" style=" background-size: cover;">
<div class="card card-shadowed p-5 w-420 mb-0 mr-2 ml-2">
    <div class="text-center mb-3">
        <a><h3>后台管理</h3></a>
    </div>

    <form   class="login-form">
        <div class="form-group has-feedback">
            <span class="mdi mdi-account" aria-hidden="true"></span>
            <input type="text" class="form-control" id="username" placeholder="用户名">
        </div>

        <div class="form-group has-feedback">
            <span class="mdi mdi-lock" aria-hidden="true"></span>
            <input type="password" class="form-control" id="password" placeholder="密码">
        </div>

        <div class="form-group has-feedback row">
            <div class="col-7">
                <span class="mdi mdi-check-all form-control-feedback" aria-hidden="true"></span>
                <input type="text" name="captcha" class="form-control" id="captcha" placeholder="验证码">
            </div>
            <div class="col-5 text-right">
                <img src="<?php echo captcha_src(); ?>" id="clickcode" class="pull-right" style="cursor: pointer;" onclick="this.src=this.src+'?d='+Math.random();" title="点击刷新" alt="captcha">
            </div>
        </div>

        <div class="form-group">
            <div class="custom-control custom-checkbox">
                <input type="checkbox" class="custom-control-input" id="rememberme">
                <label class="custom-control-label not-user-select" for="rememberme">5天内自动登录</label>
            </div>
        </div>
    </form>
        <div class="form-group">
            <button class="btn btn-block btn-primary" onclick="login()">立即登录</button>
        </div>


    <p class="text-center text-muted mb-0">Copyright © 2020 <a href="http://lyear.itshubao.com">IT书包</a>. All right reserved</p>
</div>

<script type="text/javascript" src="/static/js/jquery.min.js"></script>
<script type="text/javascript" src="/static/js/popper.min.js"></script>
<script type="text/javascript" src="/static/js/bootstrap.min.js"></script>
<script type="text/javascript" src="/static/js/perfect-scrollbar.min.js"></script>
<script type="text/javascript" src="/static/js/jquery.cookie.min.js"></script>
<script type="text/javascript" src="/static/js/jquery-confirm/jquery-confirm.min.js"></script>
<script type="text/javascript" src="/static/js/main.min.js"></script>
<script type="text/javascript" src="/static/js/lyear-loading.js"></script>
<script type="text/javascript">
    function login(){
        var l = $('body').lyearloading({
            opacity: 0.2,
            spinnerSize: 'lg'
        });
        var username = $.trim($("#username").val());
        var password = $.trim($("#password").val());
        var captcha = $.trim($("#captcha").val());
        if (username == "" || password == "" || captcha == ""){
            l.destroy();
            $.alert({
                title: '错误提示',
                icon: 'mdi mdi-alert',
                type: 'red',
                content: '请输入完整！'
            });
            $("#clickcode").click();
            return false;
        }
        $.ajax({
            type: 'post',
            url: "<?php echo url('/admin/login'); ?>",
            data: {
                'username': username,
                'password': password,
                'captcha': captcha,
            },
            dataType: "json",
            success:function (data){
                l.destroy();
                if (data.code == 200){
                    history.back (-1);
                }else{
                    $.alert({
                        title: '错误提示',
                        icon: 'mdi mdi-alert',
                        type: 'red',
                        content: data.msg
                    });
                    $("#clickcode").click();
                }
            },
            error:function (){
                $.alert({
                    title: '错误提示',
                    icon: 'mdi mdi-alert',
                    type: 'red',
                    content: '请求失败!'
                });
                $("#clickcode").click();
            }
        })
    }
</script>
</body>
</html>